<%@ page language="java" pageEncoding="UTF-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
	String id = request.getParameter("id") == null ? "0" : request.getParameter("id").trim();
	String choosetype = request.getParameter("choosetype") == null ? "checkbox" : request
			.getParameter("choosetype");

	String url = "dragon/modules/system/dic/action/DicHandler.ejw?home=" + id;
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<base href="<%=basePath%>" />
<title></title>
<link rel="stylesheet" type="text/css" href="js/zTree/css/zTreeStyle/zTreeStyle.css">
<link rel="stylesheet" type="text/css" href="css/oper_area.css" />
<link rel="stylesheet" type="text/css" href="css/dialog.css" />
<%@ include file="/webmodules/console/css.jsp"%>
<%@ include file="/webmodules/console/js.jsp"%>
<script type="text/javascript" src="js/zTree/js/jquery.ztree.core-3.0.js"></script>
<script type="text/javascript" src="js/zTree/js/jquery.ztree.excheck-3.0.js"></script>
<script type="text/javascript" src="js/zTree/js/jquery.ztree.exedit-3.0.js"></script>
<script type="text/javascript">
     var setting = {
			async:{
			    autoParam: ["id"],
			    dataFilter: null,
	         	dataType: "text",
	         	enable: true,
	         	type: "post",
	            url:"<%=url%>"
			},
			check: {
				enable: true,
				chkStyle: "<%=choosetype%>",
				radioType: "all"
			},
			data: {
				simpleData: {
					enable: true
				}
			}
		};


		$(document).ready(function(){
			$.fn.zTree.init($("#tree"), setting);
		});

		function doSelect(){
			var treeObj = $.fn.zTree.getZTreeObj("tree");
			var nodes = treeObj.getCheckedNodes(true);
			if(nodes.length==0){
				top.showMsg("", "请选择要操作的数据！", true);
			};
			var result = new Array();
			for(i=0;i<nodes.length;i++){
				result.push(nodes[i].id+":"+nodes[i].name);
			}
			window.returnValue = result;
			window.close();
		};
		
		function doCancel(){
			window.returnValue = "";
			window.close();
		}
    </script>
</head>

<body>
	<div class="page">
		<div onclick="doSelect();" style="font-size: 20px; cursor: pointer;">确定</div>
		<div onclick="doCancel();" style="font-size: 20px; cursor: pointer;">取消</div>
		<div id="tree" class="ztree"></div>
	</div>
</body>
</html>
